package com.rpc;

import com.rpc.api.ITestService;
import com.rpc.impl.TestServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class test {
    public static void main(String[] args) throws Exception {
        ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
        Object object = context.getBean("testService");
        Class clazz = Class.forName("com.rpc.impl.TestServiceImpl");
        Method method = clazz.getMethod("test", null);
        System.out.println(method.invoke(object, null));
    }
}
